<extend name="Public/common" />
<block name="body">
<script type="text/javascript" src="__JS__/jquery-ui/jquery.ui.js"></script>
<script type="text/javascript" src="__JS__/jquery-ui/i18n/zh-CN.js" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="__JS__/jquery-ui/themes/ui-lightness/jquery.ui.css"  />
<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <h3>{:@date('Y-m-d', $menu['menu_date'])} 菜谱管理</h3>
      <ul class="tab-base">
        	<li><a href="{:U('index', ['menu_id' => $menu['menu_id']])}"><span>菜品列表</span></a></li>
	        <li><a href="{:U('add', ['menu_id' => $menu['menu_id']])}"><span>新增菜品</span></a></li>
	        <li><a href="JavaScript:void(0);" class="current"><span>编辑菜品</span></a></li>
      </ul>
    </div>
  </div>
  <div class="fixed-empty"></div>
  <form id="form1" method="post" enctype="multipart/form-data" name="form1">
    <input type="hidden" name="id" value="{$info['id']}" />
    <input type="hidden" name="menu_id" value="{$menu['menu_id']}" />
    <table class="table tb-type2">
      <tbody>
        <tr class="noborder">
          <td colspan="2" class="required"><label class="validation">菜单日期:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform">{:@date('Y-m-d', $menu['menu_date'])}</td>
          <td class="vatop tips"></td>
        </tr>
        <tr>
          <td colspan="2" class="required"><label class="validation">区域:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform">{$area[$menu['area_id']]}</td>
          <td class="vatop tips"></td>
        </tr>
        <tr>
            <td colspan="2" class="required"><label class="validation" for="store_id">商户选择:</label></td>
        </tr>
        <tr class="noborder">
            <td id="gstore" class="vatop rowform"><select class='class-select' name="store_id" id="store_id">
                <option value="">-请选择-</option>
                <notempty name="store">
                    <volist name="store" id="vo">
                        <option <eq name="info.store_id" value="$key">selected='selected'</eq> value="{$key}">{$vo}</option>
                    </volist>
                </notempty>
            </select></td>
            <td class="vatop tips">商户名称 必须选择</td>
        </tr>

        <tr>
          <td colspan="2" class="required"><label class="validation" for="goods_id">菜品选择:</label></td>
        </tr>
        <tr class="noborder">
          <td id="ggoods" class="vatop rowform"><select class='class-select' name="goods_id" id="goods_id">
              <option value="">-请选择-</option>
		      <notempty name="goods">
		      <volist name="goods" id="vo">
              <option <eq name="info.goods_id" value="$vo.goods_id">selected='selected'</eq> value="{$vo['goods_id']}">{$vo['goods_name']}</option>
              </volist>
              </notempty>
            </select></td>
          <td class="vatop tips">菜品名称 必须选择</td>
        </tr>

        <tr>
          <td colspan="2" class="required"><label class="validation" for="goods_storage">库存数量:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" value="{$info['goods_storage']}" name="goods_storage" id="goods_storage" class="txt2"></td>
          <td class="vatop tips">库存数量必须填写 更改请慎重 卖完即售罄</td>
        </tr>

        <tr>
          <td colspan="2" class="required"><label class="validation" for="goods_storage">库存立减活动:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform" colspan="2">
            剩余库存 ： 最大库存
            <b><=</b> <input type="text" value="{$info['storage_two']}" name="storage_two" id="storage_two" class="txt2">
            <b><=</b> <input type="text" value="{$info['storage_one']}" name="storage_one" id="storage_one" class="txt2">
          </td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform" colspan="2">
            立减 ：
            <input type="text" value="{$info['sale_three']}" name="sale_three" id="sale_three" class="txt2">元
            <input type="text" value="{$info['sale_two']}" name="sale_two" id="sale_two" class="txt2">元
            <input type="text" value="{$info['sale_one']}" name="sale_one" id="sale_one" class="txt2">元
          </td>
        </tr>
      </tbody>
      <tfoot>
        <tr class="tfoot">
          <td colspan="15" ><a href="JavaScript:void(0);" class="btn" id="submit"><span>提交</span></a></td>
        </tr>
      </tfoot>
    </table>
  </form>
</div>
<script type="text/javascript" src="__JS__/common_select.js" charset="utf-8"></script>
<script type="text/javascript">
storeInit("gstore");
$(document).ready(function(){
	$('#start_sell_time').datepicker({dateFormat: 'yy-mm-dd'});
	$('#end_sell_time').datepicker({dateFormat: 'yy-mm-dd'});
	$('#start_deliver_time').datepicker({dateFormat: 'yy-mm-dd'});
	$('#end_deliver_time').datepicker({dateFormat: 'yy-mm-dd'});	
	$('#form1').validate({
        errorPlacement: function(error, element){
			error.appendTo(element.parent().parent().prev().find('td:first'));
        },
        rules : {
        	area_id : {
                required : true
            },
            store_id : {
                required : true
            },
            goods_id : {
                required : true
            },
            goods_storage : {
            	required : true,
                number   : true
            }
        },
        messages : {
        	area_id : {
                required : "请选择区域"
            },
            goods_id : {
                required : "请选择商户"
            },
            store_id : {
                required : "请选择商品"
            },
            goods_storage : {
            	required : "请填写库存数量",
                number   : "库存只能为数字"
            }
        }
    });

	$("#submit").click(function() {
		if ($("#form1").valid()) {
			$("#form1").submit();
		}
	});
});
</script>
</block>